package br.com.android;

import android.app.Activity;
import android.os.Bundle;
import android.widget.*;
import android.view.*;
import android.app.*;

public class AppSoma extends Activity {
    /** Called when the activity is first created. */
	EditText ednumero1, ednumero2;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        ednumero1 = (EditText) findViewById(R.id.numero1);
        ednumero2 = (EditText) findViewById(R.id.numero2);
        
        Button btsomar = (Button) findViewById(R.id.btsomar);
        
        btsomar.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				double num1 = Double.parseDouble(ednumero1.getText().toString());
				double num2 = Double.parseDouble(ednumero2.getText().toString());
				
				double res = num1 + num2;
				
				AlertDialog.Builder dialogo = new AlertDialog.Builder(AppSoma.this);
				dialogo.setTitle("AVISO");
				dialogo.setMessage("Soma: " + res);
				dialogo.setNeutralButton("OK", null);
				dialogo.show();
				
			}
		});
    }
}